package com.fxw.service.impl;

import com.fxw.annotation.MasterDataSource;
import com.fxw.annotation.ReadDataSouce;
import com.fxw.entity.TbPlayer;
import com.fxw.mapper.TbPlayerMapper;
import com.fxw.service.ITbPlayerService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author fxw
 * @since 2021-11-09
 */
@Service
public class TbPlayerServiceImpl extends ServiceImpl<TbPlayerMapper, TbPlayer> implements ITbPlayerService {

    @Autowired
    private TbPlayerMapper playerMapper;

    @Override
    @ReadDataSouce
    public List<TbPlayer> selectAll() {
        List<TbPlayer> tbPlayers = playerMapper.selectList(null);
        return tbPlayers;
    }

    @Override
    @MasterDataSource
    public Boolean addPlayer(TbPlayer player) {
        int insert = playerMapper.insert(player);
        return insert > 0;
    }
}
